import { pipeline } from "node:stream/promises";
import fs from "node:fs";
import zlib from "node:zlib";
import { testFn } from "../utils/common";

async function testPipeline() {
  await pipeline(
    fs.createReadStream("archive.tar"),
    zlib.createGzip(),
    fs.createWriteStream("archive.tar.gz")
  );

  console.log("pipeline done.");
}

function streamTest() {
  // testPipeline().catch(console.error);
  // testPipeline();
  console.log("hello stream...");
}

export default testFn(streamTest);
